
// 使用道具

// {"窗口":"主人公","序号":"67026","序列":0,"ip":"127.0.0.1","ID":"53270","编号":3,"id":"10051","时间":1743924273,"类型":"道具","效验码":""};
// @ts-ignore
export async function execute(client_id,message_json) {
   let items_key = message_json["类型"];
   let index = message_json["编号"]

   if(index === undefined || index-1 < 0){
      ClientUtils.send_basic_prompt(client_id,"#R数据非法");
      return;
   }
   index = index-1;
   let characters = G.Characters.get_current_login_characters(client_id);
   let items = characters[items_key];
   if(items === undefined){
      ClientUtils.send_basic_prompt(client_id,"#R包裹类型非法");
      return;
   }
   let item = items[index];
   if(item === undefined){
      ClientUtils.send_basic_prompt(client_id,"#背包内不存在该物品");
      return;
   }
   
   if(_ItemHandlerData.has(item["名称"])){
      await _ItemHandlerData.get(item["名称"]).run(characters,items_key,index);
   }else{
      ClientUtils.send_basic_prompt(client_id,"#该物品暂时无法使用");
   }
}
